<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script  runat="server">
Sub Page_Load(sender As Object, e As EventArgs)	
Try
   If IsPostBack() Then
	Dim strConn As String
	strConn=ConfigurationSettings.appSettings("conn")
	Dim myConn As SqlConnection  = _
	New SqlConnection(strConn)
	myConn.Open	
	Dim strSQL as String
	if Request.Form("strSQLInsert")<>"" then
		strSQL="Insert into tblSubCategories "	
		strSQL=strSQL & " values('" 
		strSQL=strSQL &  Request.Form("strSQLInsert")
		strSQL=strSQL &  "',12)"
		Dim myCom =New SqlCommand(strSQL,myConn)
		myCom.ExecuteNonQuery()
	end if	
	myConn.Close
     end if
Catch objError As Exception
	outError.innerHTML = "<b>* Error</b>: " & _
	objError.Message & "<p />"
End Try
End Sub
</script>	
<html>
<head>
<title>ADO.NET </title>
</head>
<body >   
<form runat="server" method="post">
<div id="outError" runat="server" />
<br />
Name of SubCategory to Insert<br>
<input id="strSQLInsert" 
size="50" type="text" 
runat="server" />
<br />
<input type="submit" 
value="Execute" runat="server" />
</form>                   
</body>
</html>
